<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>编辑客户</title>
		<link rel="stylesheet" href="__PUBLIC__/frame/layui/css/layui.css">
			<!--<link rel="stylesheet" href="http://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css">-->
		<link rel="stylesheet" href="__PUBLIC__/frame/static/css/style.css">
	</head>
	<body>
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			<legend>搜索</legend>
		</fieldset>
		<form class="layui-form" id="search_form" action="__SELF__" method="post">
			<div class="layui-form-item">           
				<div class="layui-inline">
					<label class="layui-form-label">部门</label>
					<div class="layui-input-inline">
						<select name="part_id" lay-filter="part_id" lay-verify="required" lay-search="">
							<option value="">直接选择或搜索选择</option>
							<?php foreach ($search['info']['part'] as $k => $v):
							if ($search['part_id']==$v['id'])
								$select = 'selected = "selected"';
							else
								$select = '';
							?>
							<option {$select} value="{$v['id']}">{$v['name']}</option>
						<?php endforeach;?>
					</select>
				</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">业务员</label>
				<div class="layui-input-inline">
					<select name="sale_worker" lay-filter="sale_worker" lay-verify="required" lay-search="">
						<option value="">直接选择或搜索选择</option>
						<?php foreach ($search['info']['sale_worker'] as $k => $v):
						if ($search['sale_worker']==$v['id'])
							$select = 'selected = "selected"';
						else
							$select = '';
						?>
						<option {$select} value="{$v['id']}">{$v['nickname']}</option>
					<?php endforeach;?>
				</select>
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">客户</label>
			<div class="layui-input-inline">
				<select name="cus_id" lay-filter="cus_id" lay-verify="required" lay-search="">
					<option value="">直接选择或搜索选择</option>
					<?php foreach ($search['info']['customer'] as $k => $v):
					if ($search['cus_id']==$v['id'])
						$select = 'selected = "selected"';
					else
						$select = '';
					?>
					<option {$select} value="{$v['id']}">{$v['cusname']}</option>
				<?php endforeach;?>
			</select>
		</div>
	</div>
	<div class="layui-inline">
		<label class="layui-form-label">查询时间段</label>
		<div class="layui-input-inline" style="width: 100px;">
			<input type="text" name="time_start" lay-verify="required" id="date2"  autocomplete="off" class="layui-input" value="{$search[time_start]}">
		</div>
		<div class="layui-form-mid">-</div>
		<div class="layui-input-inline" style="width: 100px;">
			<input type="text" name="time_end" lay-verify="required" id="date3"  autocomplete="off" class="layui-input" value="{$search[time_end]}">
		</div>
	</div> 
	<div class="layui-inline">
		<div class="layui-input-inline">
			<button type="submit" class="layui-btn layui-btn-primary layui-btn-radius">搜 索</button>
			<button type="button" id="export" class="layui-btn layui-btn-primary layui-btn-radius">导 出</button>
		</div>
	</div>
</div>
</form>
				<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
          			<legend>客户资金记录</legend>
        		</fieldset>
        		<table class="layui-table" border="" cellspacing="" cellpadding="" width="100%">
	        		<thead>
		    			<tr>
		    				<td width="5%">月份</td>
		    				<td width="8%">日期</td>		                   
		    				<td width="8%">客户姓名</td>
		    				<td width="8">充值账号</td>
		    				<td width="10">部门</td>		    				
		    				<td width="10%">业务员</td>		    				
		    				<td width="10%">主任</td>
		    				<td width="10%">经理</td>
		    				<td width="8%">操作类型</td>
		    				<td width="8%">金额</td>
		    				<td width="10%">服务到期时间</td>						
		    				<td width="5%">备注</td>
		    			</tr>
	    			</thead>
	    			<tbody>
<if condition="count($cusinfo['moneyLog']) gt 0 ">
<?php foreach ($cusinfo['moneyLog'] as $k => $v):?>
						<tr>
							<td><?php echo substr($v['operate_time'],5,-3);?></td>
							<td><?php echo $v['operate_time'];?></td>
							<td><?php echo $v['cusname'];?></td>
							<td title="<?php echo $v['number'];?>"><?php echo $v['number'];?></td>	
							<td title="<?php echo $v['divide_part'];?>"><?php echo $v['divide_part'];?></td>					
							<td title="<?php echo $v['divide_sale_worker'];?>"><?php echo $v['divide_sale_worker'];?></td>
							
							<td title="<?php echo $v['divide_sale_head'];?>"><?php echo $v['divide_sale_head']?></td>
							<td title="<?php echo $v['divide_sale_manager'];?>"><?php echo $v['divide_sale_manager']?></td>
							<td><?php echo $v['typeid'];?></td>
							<td><?php echo $v['opfare'];?></td>
							<td><?php echo $v['server_time_end']?></td>	
							<td title="<?php echo $v['remark'];?>"><?php echo $v['remark']==''?'无':'有';?></td>
						</tr>

<?php endforeach;?>  
<?php if(preg_match('/\d/', $cusinfo['page'])): ?>  
        <tr><td align="right" nowrap="true" colspan="99" height="30" class="page"><?php echo $cusinfo['page']; ?></td></tr> 
<?php endif; ?> 
					</thead>
<else/>
					<tbody><tr><td align="center" nowrap="true" colspan="99" style="font-size:24px;padding:30px 0;">无数据</td></tr></tbody>
</if>
				</table>
	</body>
</html>
<script type="text/javascript" src="__PUBLIC__/frame/layui/layui.js"></script>
<script type="text/javascript">
	layui.use(['layer','layedit', 'laydate'], function(){
		var layer = layui.layer
		,layedit = layui.layedit
		,laydate = layui.laydate
		,$  = layui.jquery;

        //日期选择
        laydate.render({
          	elem: '#date2'
        });
        laydate.render({
          	elem: '#date3'
        });
        $(document).on('click','#export',function(){
        	var part_id = $('select[name=part_id]').val();
        	var sale_worker =$('select[name=sale_worker]').val();
        	var cus_id =$('select[name=cus_id]').val();
        	var time_start = $('input[name=time_start]').val();
        	var time_end = $('input[name=time_end]').val();
        	$.post('/index.php/Hawk/Customer/exportdata',{'part_id':part_id,'sale_worker':sale_worker,'cus_id':cus_id,'time_start':time_start,'time_end':time_end},function(data){
        		document.location.href = "/index.php/Hawk/Customer/export?data=" + data;
        	});
        });
    });
</script>